<%@ page import="java.sql.*" %>
<%@ page import="dao.materialDAO" %>
<%@ page import="entity.materialBean" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%--
Created by IntelliJ IDEA.
User: Lenovo
Date: 2024/3/24
Time: 16:46
To change this template use File | Settings | File Templates.
--%>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>问卷调查</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../css/material_edit.css">
    <script type="text/javascript" src="../js/material_add.js"></script>
    <%--    <script type="text/javascript" src="js/edit.js"></script>--%>
</head>

            <%
    String error = null;
    session=request.getSession();
    materialBean editMaterialBean=(materialBean) request.getAttribute("editMaterialBean");
    %>
<body class="bkg">
<div id="container">
    <div id="headDiv">
        <div id="logo">
            <img src="../img/edit.png" width="30" height="30"/>
        </div>
        <div id="title">编辑物料信息</div>
    </div>
    <%--    onsubmit="return validateForm()"--%>
    <form name="formname" action="material_save?r_id=<%=editMaterialBean.getR_id()%>" method="post">
        <div id="editDevice">
            <table>
                <tr>
                    <td>设备名称<span id="essential1">*</span></td>
                    <td><input type="text" id="material_name" class="border" name="material_name" value="<%=editMaterialBean.getName()%>"></td>
                    <td><div class="form_error" id="1">
                        <%
                            error = (String) session.getAttribute("name_error");
                            if (error != null) {
                                out.println(error);
                            }
                        %>
                    </div></td>
                </tr>
                <tr>
                    <td>物料编号<span id="essential2">*</span></td>
                    <td><input type="text" id="id" class="border" name="material_id" value="<%=editMaterialBean.getId()%>"></td>
                    <td><div class="form_error" id="2">

                        <%
                            error = (String) session.getAttribute("id_error");
                            String material_name = editMaterialBean.getName();
                            if (error != null && (material_name == null || material_name.isEmpty())) {
                                out.println(error);
                            }
                        %>
                    </div></td>
                </tr>
                <tr>
                    <td>物料类型<span id="essential3">*</span></td>
                    <td><select name="material_type" class="border" id="type">
                        <option><%=editMaterialBean.getType()%></option>
                        <option value="金属">金属</option>
                        <option value="合金">合金</option>
                        <option value="复合材料">复合材料</option>
                        <option value="有机材料">有机材料</option>
                        <option value="其他">其他</option>
                    </select></td>
                    <td><div class="form_error" id="3">
                        <%

                            error = (String) session.getAttribute("type_error");
                            if (error != null) {
                                out.println(error);
                            }

                        %>
                    </div></td>
                </tr>
                <tr>
                    <td>生产厂商<span id="essential4">*</span></td>
                    <td><input type="text" id="manufacturer" class="border" name="material_manufacturer" value="<%=editMaterialBean.getManufacturer()%>"></td>
                    <td><div class="form_error" id="4">
                        <%
                            error = (String) session.getAttribute("manufacturer_error");
                            if (error != null) {
                                out.println(error);
                            }
                        %>
                    </div></td>
                </tr>
                <tr>
                    <td>出厂日期<span id="essential5">*</span></td>
                    <td><input type="date" id="productiondate" class="border" name="material_productiondate" value="<%=editMaterialBean.getProductiondate()%>"></td>
                    <td> <div class="form_error" id="5">
                        <%
                            error = (String) session.getAttribute("productiondate_error");
                            if (error != null) {
                                out.println(error);
                            }
                        %>
                    </div></td>
                </tr>
                <tr>
                    <td>厂址<span id="essential6">*</span></td>
                    <td><input type="text" id="factorysite" class="border" name="material_factorysite" value="<%=editMaterialBean.getFactorysite()%>"></td>
                    <td><div class="form_error" id="6">
                        <%
                            error = (String) session.getAttribute("factorysite_error");
                            if (error != null) {
                                out.println(error);
                            }
                        %>
                    </div></td>
                </tr>
                <tr>
                    <td>联系人<span id="essential7">*</span></td>
                    <td><input type="text" id="contacts" class="border" name="material_contacts" value="<%=editMaterialBean.getContacts()%>"></td>
                    <td><div class="form_error" id="7">
                        <%
                            error = (String) session.getAttribute("contacts_error");
                            if (error != null) {
                                out.println(error);
                            }
                        %>
                    </div></td>
                </tr>
                <tr>
                    <td>联系电话<span id="essential8">*</span></td>
                    <td><input type="text" id="telephone" class="border" name="material_telephone" value="<%=editMaterialBean.getTelephone()%>"></td>
                    <td><div class="form_error" id="8">
                        <%
                            error = (String) session.getAttribute("telephone_error");
                            if (error != null) {
                                out.println(error);
                            }
                        %>
                    </div></td>
                </tr>
                <tr>
                    <td>物料说明</td>
                    <td><input type="text" id="statement" class="border" name="material_statement" value="<%=editMaterialBean.getStatement()%>"></td>
                    <td></td>
                </tr>
            </table>
<%--            <label for="material_name" class="required-field"> <span>设备名称</span></label>--%>
<%--            --%>
<%--            --%>
<%--            <!-- required="required" 是必填-->--%>
<%--            <br>--%>
<%--            <label for="id" class="required-field"> <span>物料编号</span></label>--%>
<%--            --%>
<%--            --%>
<%--            <br>--%>

<%--            <label for="type" class="required-field"> <span>物料类型</span></label>--%>
<%--            --%>
<%--            --%>
<%--            <br>--%>

<%--            <label for="manufacturer" class="required-field"> <span>生产厂商</span></label>--%>
<%--            --%>
<%--            <br>--%>

<%--            <label for="productiondate" class="required-field"> <span>出厂日期</span></label>--%>
<%--           --%>
<%--            <br>--%>

<%--            <label for="factorysite" class="required-field"> <span>厂址</span></label>--%>
<%--            --%>
<%--            <br>--%>

<%--            <label for="contacts" class="required-field"> <span>联系人</span></label>--%>
<%--            --%>
<%--            <br>--%>

<%--            <label for="telephone" class="required-field"> <span>联系电话</span></label>--%>
<%--            --%>
<%--            <br>--%>

<%--            <label for="statement"> <span>物料说明</span></label>--%>
<%--            <br>--%>
            <button type="submit" id="submit" class="button1">保存</button>
            <input type="reset" id="reset" value="重置">
        </div>
    </form>
</div>
</body>
